Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IteratorSize for infinite AbstractFill #205

Merged
merged 7 commits into from
Jan 25, 2023

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Jan 23, 2023

Implement IteratorSize by looping over the types of the axes, and checking if any of them is infinite. With this and JuliaArrays/InfiniteArrays.jl#105, we obtain

julia> x = Ones(1:∞);

julia> Base.IteratorSize(x)
Base.IsInfinite()

julia> s = Iterators.Stateful(x)
Base.Iterators.Stateful{Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, Tuple{Int64, Tuple{Int64, Int64}}, Int64}(Ones(ℵ₀), (1, (1, 1)), -1)

julia> first(s,2)
2-element Vector{Int64}:
 1
 1

@codecov
Copy link

codecov bot commented Jan 23, 2023

Codecov Report

Merging #205 (dff7722) into master (617be46) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #205      +/-   ##
==========================================
+ Coverage   97.89%   97.92%   +0.03%     
==========================================
  Files           4        4              
  Lines         665      676      +11     
==========================================
+ Hits          651      662      +11     
  Misses         14       14              
Impacted Files Coverage Δ
src/FillArrays.jl 97.45% <100.00%> (+0.08%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jishnub jishnub changed the title Forward IteratorSize to ProductIterator IteratorSize for infinite AbstractFill Jan 23, 2023
@dlfivefifty dlfivefifty merged commit 0075660 into JuliaArrays:master Jan 25, 2023
@jishnub jishnub deleted the iteratorsize branch January 25, 2023 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants